import SoundUtil from "../../Fantasy/Util/SoundUtil";

const {ccclass, property} = cc._decorator;

@ccclass
export default class MatchButtonJs extends cc.Component {

    @property(cc.Node)
    release: cc.Node = null;
    @property(cc.Node)
    click: cc.Node = null;
    @property(cc.Node)
    labelNode:cc.Node = null;
    label

    // onLoad () {}
    setLabel(label){
        this.label = label;
        this.labelNode.getComponent(cc.Label).string = this.label;
    }
    btnCallback(target,data){
        SoundUtil.playEffect("music/duoClick");
        if(data == "click"){
            this.release.active = false;
            this.click.active = true;
            this.node.parent.parent.getComponent("MacthQuestJs").setAnswer(this.label);
        }else if(data == "cancel"){
            this.click.active = false;
            this.release.active = true;
            this.node.parent.parent.getComponent("MacthQuestJs").cancelAnswer(this.label);
        }

    }



    start () {

    }

    // update (dt) {}
}
